<template>
	<view>
		<xl-navbar title="商品详情"></xl-navbar>
		<xl-goods-nav
		    ref="goodsNav"
		    :leftOption="[{icon:'xl-kefu',text:'客服'}, {icon: 'xl-cart', text:'购物车'}]"
		    :rightOption="[
					{text: '加入购物车', color: '#fff', bgColor: 'linear-gradient(to right, #ffbb67, #ffbb67)'},
					{text: '立即购买', color: '#fff', bgColor: 'linear-gradient(to right, #ffbb67, #ed6d1f)'},
				]"
		    @left-click="onLeftClick"
		    @right-click="onRightClick"
		></xl-goods-nav>
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	const goods = ref({})

	const showSpecs = ref(true)
	
	function openSpec(type){
		specsType.value = type
		showSpecs.value = true
	}
	// 已选规格规格
	function specsTxtChange(txt){
		specTxt.value = txt
	}
	// 库存重量
	function stockTotalChange(num) {
		stockTotal.value = num
	}
	
	function onLeftClick(i) {
		switch (i) {
		  case 0:
				console.log('客服');
		    break
		  case 1:
				console.log('加购');
		    break
		}
	}
	
	function onRightClick(i) {
		if(i == 0) {
			openSpec('cart')
		} else {
			openSpec('both')
		}
	}
	
	function addCart(spec, num) {
	}
	// 添加订单
	function toOrder(spec, num) {
	}
</script>

<style lang="scss" scoped>
	
</style>